<cfmodule template="../../tag/layout.cfm">
<cfscript>
	if( structKeyExists(rc, "articlebaseid")  && rc.articlebaseid > 0 ){
		articlebaseid = rc.articlebaseid;
	}else{
		articlebaseid = 0;
	}
	
	if( structKeyExists(rc, "categoryid")  && rc.categoryid > 0 ){
		categoryid = rc.categoryid;
	}else{
		categoryid = 0;
	}
	
	if( structKeyExists(rc, "id")  && rc.id > 0 ){
		id = rc.id;
	}else{
		id = 0;
	}
	
	if( structKeyExists(rc, "articlecommentid")  && rc.articlecommentid > 0 ){
		articlecommentid = rc.articlecommentid;
	}else{
		articlecommentid = 0;
	}
</cfscript>
<form method="post" class="form">
	<cfoutput>
		<input type="hidden" name="articlebaseid" value="#articlebaseid#">
		<input type="hidden" name="categoryid" value="#categoryid#">
		<input type="hidden" name="articlecommentid" value="#articlecommentid#">
		<input type="hidden" name="createdip" value="#cgi.REMOTE_ADDR#">
	</cfoutput>
  <fieldset>
    <legend>评论基本信息</legend>
    <table class="table" width="100%">
      <tbody>
        <tr>
          <th>编号</th>
          <td><input name="id" readonly /></td>
        </tr>
        <tr>
          <th>评论标题</th>
          <td><input name="subject" class="easyui-validatebox" data-options="required:true"  style="width:360px;"/></td>
        </tr>
        <tr>
          <th>评论内容</th>
          <td><textarea id="content" name="content" style="width:360px; height:150px;" class="easyui-validatebox" data-options="required:true"></textarea></td>
        </tr>
        <tr>
        	<th>是否发布</th>
          	<td><input name="ispublish" type="checkbox" value="1" /></td>
        </tr>
        <tr>
	      <th>信息排序</th>
	      <td><input name="seq" class="easyui-numberspinner"  value="0"  style="width:50px;" /></td>
	    </tr>
      </tbody>
    </table>
  </fieldset>
</form>
</cfmodule>
<script type="text/javascript">
	var closeDialog = function($dialog) {
		$dialog.dialog('destroy');
	}
	
	var submitNow = function($dialog, $grid, $pjq) {
		var url;
		if ($(':input[name="id"]').val().length > 0) {
			url = '?action=articlecomment.update'; //更新操作
		} else {
			url = '?action=articlecomment.save';	//新增操作
		}

		$.post(url, fw.serializeObject($('form')), function(result) {
			if (result) {
				$grid.treegrid('reload');
				$dialog.dialog('destroy');
			}
		}, 'json');
	};
	
	var submitForm = function($dialog, $grid, $pjq) {
		if ($('form').form('validate')) {
			submitNow($dialog, $grid, $pjq);
		}
	};

	$(function(){
		//加载数据，初始进度条
		parent.$.messager.progress({
			text : '数据加载中....'
		});
		
		$.ajax({
		    type: "POST",
		    url: "?action=articlecomment.get",
		    data: {
		        id:<cfoutput>#id#</cfoutput>
		    }
		}).done(function(result) {
			$('form').form('load', result); 
			parent.$.messager.progress('close');
		}, 'json');
		
		
	})
</script>	 
